package com.taiji.dicom4platform.common.security.config;

import com.taiji.dicom4platform.common.security.provider.SecurityAuthenticationProvider;
import com.taiji.dicom4platform.common.security.service.PermissionService;
import lombok.AllArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;


/**
 * @Description
 * @Author fanxl
 * @Date 2021/6/3
 **/
@Configuration
@AllArgsConstructor
public class OauthAutoConfig {


    @Bean
    @Order(1)
    public PasswordEncoder getPasswordEncoder(){
        return new BCryptPasswordEncoder();
    }

    @Bean
    @Order(2)
    public SecurityAuthenticationProvider getSecurityAuthenticationProvider(){
        return new SecurityAuthenticationProvider();
    }

    @Bean("pms")
    public PermissionService permissionService() {
        return new PermissionService();
    }

}
